﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PMS.XCMG.Util;

namespace PMS.XCMG.Entity
{
    /// <summary>
    /// 班时
    /// </summary>
    public partial class TeamTime : BusEntity
    {
        /// <summary>
        /// 编码
        /// </summary>
        public string Code { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 开始时间（格式：HH:mm）
        /// </summary>
        public string StartTime { set; get; }
        /// <summary>
        /// 结束时间（格式：HH:mm）
        /// </summary>
        public string EndTime { set; get; }
    }

    public partial class TeamTime : BusEntity
    {
    }

    /// <summary>
    /// 实体配置
    /// OnModelCreating
    /// </summary>
    public class TeamTimeTypeConfig : BusEntityTypeConfig<TeamTime>, IEntityTypeConfiguration<TeamTime>
    {
        public override void Configure(EntityTypeBuilder<TeamTime> builder)
        {
            base.Configure(builder);

            #region 主外键关系
            #endregion

            #region 字段属性:最大长度,是否必需,默认值
            builder.Property(p => p.Code).HasMaxLength(EntityDefinition.DefSmallColLen).IsRequired();
            builder.Property(p => p.Name).HasMaxLength(EntityDefinition.DefSmallColLen).IsRequired();
            builder.Property(p => p.StartTime).IsRequired();
            builder.Property(p => p.EndTime).IsRequired();
            #endregion

            #region 备注
            builder.HasComment("班时");
            builder.Property(p => p.Code).HasComment("班时编码");
            builder.Property(p => p.Name).HasComment("班时名称");
            builder.Property(p => p.StartTime).HasComment("开始时间（格式：HH:mm）");
            builder.Property(p => p.EndTime).HasComment("结束时间（格式：HH:mm）");
            #endregion

            #region 种子数据
            #endregion
        }
    }
}
